﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class DeliveryOrderRptQuery : BasePage
    {
        protected Button btnSearch;
        protected DropDownList ddlCreatedBy;
        protected DropDownList ddlCustomerID;
        protected DropDownList ddlDeliveryID;
        protected DropDownList ddlExternOrderID2;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlReceipted;
        protected DropDownList ddlStatusOper;
        protected HtmlForm F15710;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected Label lblBeginDate;
        protected Label lblCreatedBy;
        protected Label lblCustomerID;
        protected Label lblDeliveryID;
        protected Label lblEndDate;
        protected Label lblExternOrderID2;
        protected Label lblOwnerID;
        protected Label lblReceipted;
        protected Label lblStatus;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtBeginDate;
        protected TextBox txtCreatedBy;
        protected TextBox txtCustomerID;
        protected TextBox txtDeliveryID;
        protected TextBox txtEndDate;
        protected TextBox txtExternOrderID2;
        protected TextBox txtOwnerID;
        protected TextBox txtReceipted;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("DeliveryOrderRptList.aspx", false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlDeliveryID, 0);
            base.InitQueryDDL(this.ddlExternOrderID2, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlCustomerID, 0);
            base.InitQueryDDL(this.ddlReceipted, 0);
            base.InitQueryDDL(this.ddlCreatedBy, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.BindData2DDLBySysCode(this.MSCStatus, "DeliveryOrderStatus");
            this.ddlStatusOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
            }
        }

        public string BeginDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtBeginDate.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtBeginDate.Text).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "";
            }
        }

        public string CreatedBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreatedBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreatedBy.Text.Trim(), this.ddlCreatedBy.SelectedValue);
                }
                return "";
            }
        }

        public string CustomerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCustomerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCustomerID.Text.Trim(), this.ddlCustomerID.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryID.Text.Trim(), this.ddlDeliveryID.SelectedValue);
                }
                return "";
            }
        }

        public string EndDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndDate.Text).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "";
            }
        }

        public string ExternOrderID2
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternOrderID2.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternOrderID2.Text.Trim(), this.ddlExternOrderID2.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string Receipted
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceipted.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceipted.Text.Trim(), this.ddlReceipted.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

